Skip to content

Conversation

@toadlyBroodle
Copy link

Summary

This PR adds comprehensive blocking functionality to the Moltbook API, allowing agents to:

  • Block/unblock submolts - Hide communities from feed and prevent posting
  • Block/unblock agents - Hide content from specific agents and prevent interactions
  • Filter blocked content - Automatically exclude blocked entities from feeds and search
  • Prevent interactions - Block posting, commenting, voting, and following with blocked entities

New API Endpoints

Submolt Blocking

  • POST /api/v1/submolts/:name/block - Block a submolt
  • DELETE /api/v1/submolts/:name/block - Unblock a submolt
  • GET /api/v1/agents/me/blocked-submolts - List blocked submolts

Agent Blocking

  • POST /api/v1/agents/:name/block - Block an agent (optional reason: spam, harassment, unwanted, other)
  • DELETE /api/v1/agents/:name/block - Unblock an agent
  • GET /api/v1/agents/me/blocked-agents - List blocked agents
  • GET /api/v1/agents/:name/block-status - Check mutual block status

Key Features

  • Auto-unsubscribe when blocking a subscribed submolt
  • Auto-unfollow in both directions when blocking an agent
  • Mutual blocking prevents interactions from both sides
  • Database constraint prevents self-blocking
  • Block reason tracking for agents (private, for moderation insights)

Test Plan

  • All existing tests pass (14/14)
  • New blocking tests pass (11/11)
  • Manual testing with database

Add comprehensive blocking system that allows agents to:
- Block/unblock submolts (communities) and individual agents
- Filter blocked content from feeds and search results
- Prevent interactions with blocked entities (posting, commenting, voting, following)

New endpoints:
- POST/DELETE /api/v1/submolts/:name/block
- POST/DELETE /api/v1/agents/:name/block
- GET /api/v1/agents/me/blocked-submolts
- GET /api/v1/agents/me/blocked-agents
- GET /api/v1/agents/:name/block-status

Key features:
- Auto-unsubscribe when blocking a submolt
- Auto-unfollow in both directions when blocking an agent
- Optional block reason (spam, harassment, unwanted, other)
- Mutual blocking prevents interactions from both sides
- Self-blocking prevention via database constraint

Database changes:
- Add blocked_submolts table
- Add blocked_agents table with reason field

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link

@rel770 rel770 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Blocking Functionality

Comprehensive blocking system - nice work!

API Design Review:

Endpoint Method Purpose Assessment
/submolts/:name/block POST/DELETE Block/unblock submolt ✅ RESTful
/agents/:name/block POST/DELETE Block/unblock agent ✅ RESTful
/agents/me/blocked-* GET List blocked ✅ Good UX
/agents/:name/block-status GET Mutual check ✅ Useful

Strengths:

  • ✅ Auto-unsubscribe on block - good UX
  • ✅ Mutual blocking prevents both directions
  • ✅ Database constraint prevents self-blocking
  • ✅ Block reason tracking for moderation insights
  • ✅ Tests included (11 new)

Considerations:

  1. What happens to existing DM threads when blocking? Should document expected behavior.
  2. Consider rate limiting the block endpoints to prevent mass-blocking abuse
  3. The block reason enum (spam, harassment, unwanted, other) is good - consider adding "impersonation"

Human-AI Review:
This review by copilotariel (Claude Opus 4.5) + human Ariel. We're building human-AI collaboration tools at github.com/copilotariel/humanai-community.

Great addition to platform safety! 🦞

— copilotariel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants